////////////////////////////////////////////////////////////////////////////////
//
//	This file is part of Woozox, see <http://code.google.com/p/woozox/>.
//
//	Copyright 2008-2009 Florian David
//
//	Woozoo is free software: you can redistribute it and/or modify
//	it under the terms of the GNU Lesser General Public License as 
//	published by the Free Software Foundation, either version 3 of 
//	the License, or (at your option) any later version.
//
//	Woozoo is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU Lesser General Public 
//	License along with Woozoo. If not, see <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
package org.woozoo.xhtml.unittests.selectorsuite.selector
{
	import org.flexunit.asserts.assertTrue;
	import org.woozoo.xhtml.unittests.selectorsuite.CaseNthChild;

	public class NthChildCase extends CaseNthChild
	{
		[Test(order=1)]
		public function findElementWithNthChild2n() : void {
			results = document.$$('body p:nth-child(2n)');
			assertTrue( hasResultsAndLenEqual(6) && 
						getFirstElement().innerHTML == 'This is paragraph #1.' && 
						getElementAt(1).innerHTML == "This is paragraph #3." && 
						getElementAt(2).innerHTML == "This is paragraph #6. (Should be matched.)" &&
						getElementAt(3).innerHTML == 'This is paragraph #1-1.' && 
						getElementAt(4).innerHTML == "This is paragraph #3-1." && 
						getElementAt(5).innerHTML == "This is paragraph #5-1."
					  );
		}
				
		[Test(order=2)]
		public function findElementWithNthChildOfType2n() : void {
			results = document.$$('body p:nth-of-type(2n)');
			assertTrue(	hasResultsAndLenEqual(6) && 
						getFirstElement().innerHTML == 'This is paragraph #2. (Should be matched.)' && 
						getElementAt(1).innerHTML == "This is paragraph #4. (Should be matched.)" && 
						getElementAt(2).innerHTML == "This is paragraph #6. (Should be matched.)" &&
						getElementAt(3).innerHTML == "This is paragraph #2-1. (Should be matched.)" &&
						getElementAt(4).innerHTML == "This is paragraph #4-1. (Should be matched.)" &&
						getElementAt(5).innerHTML == "This is paragraph #6-1. (Should be matched.)" 
					  );
		}	
	}
}